Question 1: Accessing Datasets for US State Boundaries, North American Country Boundaries, and US Cities
For this project we want to calculate distances between features, therefore we need a projection that preserves distance at the scale of CONUS. For this, we will use the North America Equidistant Conic:
eqdc = '+proj=eqdc +lat_0=40 +lon_0=-96 +lat_1=20 +lat_2=60 +x_0=0 +y_0=0 +datum=NAD83 +units=m +no_defs'
Based on its parameters, this projection has a name of eqdc, a latitude of origin at 40, central meridian at 96, latitude of first standard parallel at 20 and second standard parallel at 60, datum name of NAD83, and units in meters.
conus = USAboundaries::us_states() %>%
filter(!state_name %in% c("Puerto Rico", "Alaska", "Hawaii")) %>%
st_transform(eqdc)
na_boundaries <- rnaturalearth::countries110
na_boundaries <- na_boundaries %>%
st_as_sf() %>%
filter(admin %in% c("United States of America", "Mexico", "Canada")) %>%
st_transform(eqdc)
cities = readr::read_csv("../data/uscities.csv") %>%
st_as_sf(coords = c("lng", "lat"), crs = 4326) %>%
st_transform(eqdc) %>%
filter(!state_name %in% c("Alaska", "Hawaii", "Puerto Rico"))
## Parsed with column specification:
## cols(
## city = col_character(),
## city_ascii = col_character(),
## state_id = col_character(),
## state_name = col_character(),
## county_fips = col_double(),
## county_name = col_character(),
## county_fips_all = col_character(),
## county_name_all = col_character(),
## lat = col_double(),
## lng = col_double(),
## population = col_double(),
## density = col_double(),
## source = col_character(),
## military = col_logical(),
## incorporated = col_logical(),
## timezone = col_character(),
## ranking = col_double(),
## zips = col_character(),
## id = col_double()
## )